gtkdnd-quartz: fix gtk_drag_begin_internal
authorChristoph Reiter <reiter.christoph@gmail.com>
Thu, 17 Dec 2015 17:02:13 +0000 (18:02 +0100)
committerChristoph Reiter <creiter@src.gnome.org>
Fri, 1 Jan 2016 14:05:23 +0000 (15:05 +0100)
gtk_drag_begin_internal was changed to take a GtkImageDefinition
instead of a GtkIconHelper. This adjusts the quartz variant
accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=759607

gtk/gtkdnd-quartz.c

index 08240b0979f25bac5866b4b2e9a84d24704f00ad..df2dbff4e4b2df8aff193d3d919ac773fb932476 100644 (file)
@@ -1179,13 +1179,13 @@ gtk_drag_begin_idle (gpointer arg)
 
 GdkDragContext *
 gtk_drag_begin_internal (GtkWidget         *widget,
-                        GtkIconHelper     *icon_helper,
+                        GtkImageDefinition *icon,
                         GtkTargetList     *target_list,
                         GdkDragAction      actions,
                         gint               button,
-                        GdkEvent          *event,
-                        gint               x,
-                        gint               y)
+                        const GdkEvent    *event,
+                        int               x,
+                        int               y)
 {
   GtkDragSourceInfo *info;
   GdkDevice *pointer;
@@ -1272,37 +1272,34 @@ gtk_drag_begin_internal (GtkWidget         *widget,
    * application may have set one in ::drag_begin, or it may
    * not have set one.
    */
-  if (!info->icon_surface)
+  if (!info->icon_surface && icon)
     {
-      if (!icon_helper || _gtk_icon_helper_get_is_empty (icon_helper))
-        gtk_drag_set_icon_default (context);
-      else
+      switch (gtk_image_definition_get_storage_type (icon))
         {
-          switch (_gtk_icon_helper_get_storage_type (icon_helper))
-            {
-              case GTK_IMAGE_PIXBUF:
-                  gtk_drag_set_icon_pixbuf (context,
-                                            _gtk_icon_helper_peek_pixbuf (icon_helper),
-                                            -2, -2);
-                  break;
-              case GTK_IMAGE_STOCK:
-                  gtk_drag_set_icon_stock (context,
-                                           _gtk_icon_helper_get_stock_id (icon_helper),
-                                           -2, -2);
-                  break;
-              case GTK_IMAGE_ICON_NAME:
-                  gtk_drag_set_icon_name (context,
-                                          _gtk_icon_helper_get_icon_name (icon_helper),
-                                          -2, -2);
-                  break;
-              case GTK_IMAGE_EMPTY:
-              default:
-                  g_assert_not_reached();
-                  break;
-            }
+          case GTK_IMAGE_PIXBUF:
+              gtk_drag_set_icon_pixbuf (context,
+                                        gtk_image_definition_get_pixbuf (icon),
+                                        -2, -2);
+              break;
+          case GTK_IMAGE_STOCK:
+              gtk_drag_set_icon_stock (context,
+                                       gtk_image_definition_get_stock (icon),
+                                       -2, -2);
+              break;
+          case GTK_IMAGE_ICON_NAME:
+              gtk_drag_set_icon_name (context,
+                                      gtk_image_definition_get_icon_name (icon),
+                                      -2, -2);
+              break;
+          default:
+              break;
         }
     }
 
+  /* no image def or no supported type -> set the default */
+  if (!info->icon_surface)
+    gtk_drag_set_icon_default (context);
+
   /* drag will begin in an idle handler to avoid nested run loops */
 
   g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL);